package com.loanapp.service;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.loanapp.domain.LoanApplication;

public class MessageReceiverCreditProcessImpl implements
		MessageReceiverCreditProcess {

	private static Log log = LogFactory
			.getLog(MessageReceiverCreditProcessImpl.class);

	private JmsReceiverCreditProcess jmsReceiver;

	public JmsReceiverCreditProcess getJmsReceiver() {
		return this.jmsReceiver;
	}

	public void setJmsReceiver(JmsReceiverCreditProcess jmsReceiver) {
		this.jmsReceiver = jmsReceiver;
	}

	public LoanApplication receive() {
		LoanApplication loanApp = new LoanApplication();
		try {
			log.debug("MessageReceiverCreditProcessImpl started");

			loanApp = jmsReceiver.receiveMessage();

			log.debug("MessageReceiverImpl end");
		} catch (Exception e) {
			log.error(e, e);
		}

		return loanApp;
	}
}
